package com.einmeer.kssc_administrator.controller;

import com.einmeer.kssc_administrator.entity.purview.Purview;
import com.einmeer.kssc_administrator.service.PurviewService;
import com.einmeer.kssc_administrator.vo.ResultVo;
import jakarta.annotation.Resource;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

/**
 * @author 芊嵛
 * @date 2024/2/27
 */
@RestController
@RequestMapping("/purview")
public class PurviewController {
    @Resource
    private PurviewService purviewService;

    /**
     * 查询所有权限具体内容
     *
     * @return
     */
    @GetMapping("/queryPurviewContent")
    @CrossOrigin
    public ResultVo queryPurviewContent() {
        return purviewService.queryPurviewContent();
    }

    /**
     * 查询所有权限种类
     *
     * @return
     */
    @GetMapping("/queryPurview")
    @CrossOrigin
    public ResultVo queryPurview() {
        return purviewService.queryPurview();
    }

    /**
     * 用于修改权限，根据id查询权限
     *
     * @param purviewId
     * @return
     */
    @GetMapping("/queryPurviewContentId")
    @CrossOrigin
    public ResultVo queryPurviewContentId(Integer purviewId) {
        return purviewService.queryPurviewContentId(purviewId);
    }

    /**
     * 修改停用与启用
     */
    @PutMapping("/changePurviewState")
    @CrossOrigin
    public ResultVo changePurviewState(Purview purview) {
        return purviewService.changePurviewState(purview.getPurviewId(), purview.getPurviewState());
    }
}
